﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="profile.aspx.vb" Inherits="felixfinalproject2.profile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <br /><center>
    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="dinerid" DataSourceID="SqlDataSource1">
        <Columns>
            <asp:ImageField DataImageUrlField="portrait" DataImageUrlFormatString="{0}" 
                AlternateText="Profile Picture" HeaderText="Profile Picture">
                <ControlStyle Height="100px" Width="140px" />
            </asp:ImageField>
        </Columns>
    </asp:GridView>
    <br/><br/>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="dinerid" DataSourceID="SqlDataSource1" CellPadding="4" 
            ForeColor="#333333" GridLines="None">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    <Columns>
        <asp:BoundField DataField="firstname" HeaderText="Firstname" 
            SortExpression="firstname" />
        <asp:BoundField DataField="lastname" HeaderText="Lastname" 
            SortExpression="lastname" />
        <asp:BoundField DataField="dateofbirth" HeaderText="Dateofbirth" 
            SortExpression="dateofbirth" />
        <asp:BoundField DataField="gender" HeaderText="Gender" 
            SortExpression="gender" />
        <asp:BoundField DataField="registrationdate" HeaderText="Registrationdate" 
            SortExpression="registrationdate" />
    </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:mercedesbenzconnectionstring %>" 
    ProviderName="<%$ ConnectionStrings:mercedesbenzconnectionstring.ProviderName %>" 
    SelectCommand="SELECT [dinerid], [firstname], [lastname], [portrait], [dateofbirth], [gender], [registrationdate] FROM [userprofile] WHERE ([dinerid] = ?)">
    <SelectParameters>
        <asp:QueryStringParameter Name="dinerid" QueryStringField="dinerid" 
            Type="String" />
    </SelectParameters>
</asp:SqlDataSource>
    <br />
    <br />
<asp:Button ID="Button1" runat="server" PostBackUrl="~/editprofile.aspx" 
    Text="Edit Profile" />
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
        DataSourceID="SqlDataSource2" GroupItemCount="3">
        <AlternatingItemTemplate>
            <td runat="server" style="background-color: #FAFAD2;color: #284775;">

                <center><a href='viewpicture.aspx?id=<%# Eval("id") %>'> <img src='<%# Eval("pictures") %>' alt="picture" style="width:200px;height:150px; margin:auto;"/></a></center>

            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <td runat="server" style="background-color: #FFCC66;color: #000080;">
                ID:
                <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                <br />dinerid:
                <asp:TextBox ID="dineridTextBox" runat="server" Text='<%# Bind("dinerid") %>' />
                <br />pictures:
                <asp:TextBox ID="picturesTextBox" runat="server" 
                    Text='<%# Bind("pictures") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <br />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
                <br />
            </td>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        You have not added any pictures yet</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
<td runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
            <td runat="server" style="">
                dinerid:
                <asp:TextBox ID="dineridTextBox" runat="server" Text='<%# Bind("dinerid") %>' />
                <br />pictures:
                <asp:TextBox ID="picturesTextBox" runat="server" 
                    Text='<%# Bind("pictures") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <br />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
                <br />
            </td>
        </InsertItemTemplate>
        <ItemTemplate>
            <td runat="server" style="background-color: #FFFBD6;color: #333333;">

               <center><a href='viewpicture.aspx?id=<%# Eval("id") %>'> <img src='<%# Eval("pictures") %>' alt="picture" style="width:200px;height:150px; margin:auto;"/></a></center>

            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="12">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowLastPageButton="True" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <td runat="server" 
                style="background-color: #FFCC66;font-weight: bold;color: #000080;">
                ID:
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                <br />dinerid:
                <asp:Label ID="dineridLabel" runat="server" Text='<%# Eval("dinerid") %>' />
                <br />pictures:
                <asp:Label ID="picturesLabel" runat="server" Text='<%# Eval("pictures") %>' />
                <br />
            </td>
        </SelectedItemTemplate>
    </asp:ListView>
    <asp:Button ID="Button2" runat="server" Text="Add Pictures" />
    <br />
    <br />
    <asp:FileUpload ID="pic_upload" runat="server" />
    <br />
    <br />
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:mercedesbenzconnectionstring %>" 
        ProviderName="<%$ ConnectionStrings:mercedesbenzconnectionstring.ProviderName %>" 
        SelectCommand="SELECT * FROM [userpictures] WHERE ([dinerid] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="dinerid" QueryStringField="dinerid" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:ListView ID="ListView2" runat="server" DataKeyNames="ID" 
        DataSourceID="SqlDataSource3" GroupItemCount="3">
        <AlternatingItemTemplate>
            <td runat="server" style="">
                
                <br />model:
                <asp:Label ID="modelLabel" runat="server" Text='<%# Eval("model") %>' />              
                <br/> Personal Rating:
                <asp:Label ID="michelin_starsLabel" runat="server" Text='<%# Eval("michelin_stars") %>' />                
                <br />
                <center><a href='details.aspx?id=<%# Eval("id") %>'>
             <img src='<%# Eval("car_picture") %>' alt="profile picture" style="width:150px;height:100px; margin:auto;"/></a></center>
             <br/>
            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <td runat="server" style="">
                ID:
                <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                <br />model:
                <asp:TextBox ID="modelTextBox" runat="server" Text='<%# Bind("model") %>' />
                <br />production_year:
                <asp:TextBox ID="production_yearTextBox" runat="server" 
                    Text='<%# Bind("production_year") %>' />
                <br />body_type:
                <asp:TextBox ID="body_typeTextBox" runat="server" 
                    Text='<%# Bind("body_type") %>' />
                <br />price:
                <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
                <br />features:
                <asp:TextBox ID="featuresTextBox" runat="server" 
                    Text='<%# Bind("features") %>' />
                <br />official_site_link:
                <asp:TextBox ID="official_site_linkTextBox" runat="server" 
                    Text='<%# Bind("official_site_link") %>' />
                <br />car_picture:
                <asp:TextBox ID="car_pictureTextBox" runat="server" 
                    Text='<%# Bind("car_picture") %>' />
                <br />michelin_stars:
                <asp:TextBox ID="michelin_starsTextBox" runat="server" 
                    Text='<%# Bind("michelin_stars") %>' />
                <br />comment_id_fk:
                <asp:TextBox ID="comment_id_fkTextBox" runat="server" 
                    Text='<%# Bind("comment_id_fk") %>' />
                <br />picture_id_fk:
                <asp:TextBox ID="picture_id_fkTextBox" runat="server" 
                    Text='<%# Bind("picture_id_fk") %>' />
                <br />AddedBy:
                <asp:TextBox ID="AddedByTextBox" runat="server" Text='<%# Bind("AddedBy") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <br />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
                <br />
            </td>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" style="">
                <tr>
                    <td>
                        You have not uploaded any cars to the database yet.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
<td runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
            <td runat="server" style="">
                model:
                <asp:TextBox ID="modelTextBox" runat="server" Text='<%# Bind("model") %>' />
                <br />production_year:
                <asp:TextBox ID="production_yearTextBox" runat="server" 
                    Text='<%# Bind("production_year") %>' />
                <br />body_type:
                <asp:TextBox ID="body_typeTextBox" runat="server" 
                    Text='<%# Bind("body_type") %>' />
                <br />price:
                <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
                <br />features:
                <asp:TextBox ID="featuresTextBox" runat="server" 
                    Text='<%# Bind("features") %>' />
                <br />official_site_link:
                <asp:TextBox ID="official_site_linkTextBox" runat="server" 
                    Text='<%# Bind("official_site_link") %>' />
                <br />car_picture:
                <asp:TextBox ID="car_pictureTextBox" runat="server" 
                    Text='<%# Bind("car_picture") %>' />
                <br />michelin_stars:
                <asp:TextBox ID="michelin_starsTextBox" runat="server" 
                    Text='<%# Bind("michelin_stars") %>' />
                <br />comment_id_fk:
                <asp:TextBox ID="comment_id_fkTextBox" runat="server" 
                    Text='<%# Bind("comment_id_fk") %>' />
                <br />picture_id_fk:
                <asp:TextBox ID="picture_id_fkTextBox" runat="server" 
                    Text='<%# Bind("picture_id_fk") %>' />
                <br />AddedBy:
                <asp:TextBox ID="AddedByTextBox" runat="server" Text='<%# Bind("AddedBy") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <br />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
                <br />
            </td>
        </InsertItemTemplate>
        <ItemTemplate>
            <td runat="server" style="">
               
                <br />model:
                <asp:Label ID="modelLabel" runat="server" Text='<%# Eval("model") %>' />              
                <br/> Personal Rating:
                <asp:Label ID="michelin_starsLabel" runat="server" Text='<%# Eval("michelin_stars") %>' />                
                <br />
                <center><a href='details.aspx?id=<%# Eval("id") %>'>
             <img src='<%# Eval("car_picture") %>' alt="profile picture" style="width:150px;height:100px; margin:auto;"/></a></center>
             <br/>                

            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" style="">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="12">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowLastPageButton="True" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <td runat="server" style="">
                ID:
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                <br />model:
                <asp:Label ID="modelLabel" runat="server" Text='<%# Eval("model") %>' />
                <br />production_year:
                <asp:Label ID="production_yearLabel" runat="server" 
                    Text='<%# Eval("production_year") %>' />
                <br />body_type:
                <asp:Label ID="body_typeLabel" runat="server" Text='<%# Eval("body_type") %>' />
                <br />price:
                <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
                <br />features:
                <asp:Label ID="featuresLabel" runat="server" Text='<%# Eval("features") %>' />
                <br />official_site_link:
                <asp:Label ID="official_site_linkLabel" runat="server" 
                    Text='<%# Eval("official_site_link") %>' />
                <br />car_picture:
                <asp:Label ID="car_pictureLabel" runat="server" 
                    Text='<%# Eval("car_picture") %>' />
                <br />michelin_stars:
                <asp:Label ID="michelin_starsLabel" runat="server" 
                    Text='<%# Eval("michelin_stars") %>' />
                <br />comment_id_fk:
                <asp:Label ID="comment_id_fkLabel" runat="server" 
                    Text='<%# Eval("comment_id_fk") %>' />
                <br />picture_id_fk:
                <asp:Label ID="picture_id_fkLabel" runat="server" 
                    Text='<%# Eval("picture_id_fk") %>' />
                <br />AddedBy:
                <asp:Label ID="AddedByLabel" runat="server" Text='<%# Eval("AddedBy") %>' />
                <br />
            </td>
        </SelectedItemTemplate>
    </asp:ListView>
    <br/>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:mercedesbenzconnectionstring %>" 
        ProviderName="<%$ ConnectionStrings:mercedesbenzconnectionstring.ProviderName %>" 
        SelectCommand="SELECT cars.ID, cars.model, cars.production_year, cars.body_type, cars.price, cars.features, cars.official_site_link, cars.car_picture, cars.michelin_stars, cars.comment_id_fk, cars.picture_id_fk, cars.AddedBy FROM (cars INNER JOIN userprofile ON cars.AddedBy = userprofile.dinerid) WHERE (userprofile.dinerid = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="AddedBy" QueryStringField="dinerid" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    <br />
    <asp:Button ID="btn_addnewcars" runat="server" Text="Add New Cars" />
    <br />
    <br />
    <br />
    </center>
</asp:Content>


